/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-05-12
 * Time: 8:41
 */
public class Test {
    public static void main(String[] args) {
        int num = 10;
        String str =String.valueOf(num);
        String str1 = num + " ";
        System.out.println(str);
        System.out.println(str1);
    }
    public static void main16(String[] args) {
        String s = "123";
        int a = Integer.parseInt(s);//123
        System.out.println(s);
    }
    public static void main15(String[] args) {
        String a = "hello";
        String b = "world";
        System.out.println(a);
        System.out.println(b);
        System.out.println(a + b);
    }
    public static void main14(String[] args) {
        int a = 10;
        long b =20L;
        long c = a + b;
        System.out.println(c);
        double d = 1.0;
        double e = a + d;
        System.out.println(e);
     /*   short a = 1;
        short b = 2;
        short a1 = a+b;//不兼容的类型: 从int转换到short可能会有损失
        System.out.println(a1);
        byte c = 3;
        byte d = 10;
        byte c1 = c + d;//不兼容的类型: 从int转换到short可能会有损失
        System.out.println(c1);*/
        /*int e = 30;
        int f = 50;
        int e1 = e + f;// 80
        System.out.println(e1);
*/
    }
    public static void main13(String[] args) {
        int a = 10;
        long b =20L;
        a = (int)b;
        System.out.println(a);
        float c = 3.14f;
        double d = 1.0;
        c = (float)d;
        System.out.println(c);
        a = (int)d;
        System.out.println(a);
        byte b1 = 100;        // 100默认为int，没有超过byte范围，隐式转换
        byte b2 = (byte)257; // 257默认为int，超过byte范围，需要显示转换，
        System.out.println(b2);
    }
    public static void main12(String[] args) {
       int a = 10;
       long b =20L;
       b = a;
       System.out.println(b);
       float c = 3.14f;
       double d = 1.0;
       d = c;
       System.out.println(d);
       byte e = 10;
       int f = 100;
       f = e;
       System.out.println(f);
        /*int a = 10;
        long b =20L;
        a = b;//大范围转换成小范围，数据丢失
        System.out.println(a);*/
    }
    public static void main11(String[] args) {
        boolean a = true;
        System.out.println(a);
       /* boolean b = false;
        System.out.println(b +1);*/ //二元运算符 '+' 的操作数类型错误
    }
    public static void main10(String[] args) {
        char a = 'A';
        char b = '1';
        char c = '帅';
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
    }
    public static void main9(String[] args) {
//        float a = 1.0;//再给float进行初始化时要在初始化值后面+F/f，否则会默认为double型
        float a = 1.0f;
        float b = 1.0F;
        System.out.println(a);
        System.out.println(b);
        System.out.println(Float.MIN_VALUE);
        System.out.println(Float.MAX_VALUE);
    }
    public static void main8(String[] args) {
       /* double a = 3.14;
        System.out.println(a);*/
        /*int a = 1;
        int b = 2;
        System.out.println(a/b);//0*/
        /*double a = 1.0;
        double b= 2.0;
        System.out.println(a/b);
        double num = 1.1;
        System.out.println(num*num);*/
        System.out.println(Double.MIN_VALUE);
        System.out.println(Double.MAX_VALUE);

    }
    public static void main7(String[] args) {
        byte a = 10;
        byte b ='A';
        System.out.println(a);
        System.out.println(b);
        System.out.println(Byte.MIN_VALUE);
        System.out.println(Byte.MAX_VALUE);

    }
    public static void main6(String[] args) {
        short a = 10;//定义同时也初始化
        short b = 0;//没有合适的初始值，可以设置为0
        short c;//定义
        c = 10;//初始化
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(Short.MIN_VALUE);
        System.out.println(Short.MAX_VALUE);
    }
    public static void main5(String[] args) {
        long a = 10;//定义同时也初始化
        long b = 10L;//L 和l是区分int和long类型
        long c= 10l;
        long d;//定义
        d = 20;//初始化
        long e = 0;//没有合适的初始值，可以设置为0
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(d);
        System.out.println(e);
        System.out.println(Long.MIN_VALUE);//最小值
        System.out.println(Long.MAX_VALUE);//最大值

    }
    public static void main4(String[] args) {
        //System.out.println(Integer.MIN_VALUE);
        //System.out.println(Integer.MAX_VALUE);
        //int b = 2147483648; 超出int的最大值，报错了
        int a = 2147483647;
        System.out.println(a+1);//-2147483648
        System.out.println(a+2);//-2147483647
        System.out.println(a+5);//-2147483644
    }
    public static void main3(String[] args) {
        int a = 10;
        System.out.println(a);
//        int a = 20;
//        System.out.println(a);//变量名不能相同
        int b ;
        b = 10;
        System.out.println(b);
      /*  int a;
        System.out.println(a);
        a = 10;*/
    }
    public static void main2(String[] args) {
        int a = 10;//定义同时也初始化
        double b = 3.14;
        char c = 'A';
        boolean d = true;
        int e;//定义
        e = 30;//初始化
        a =100;//a是变量修改a的值
        int f = 20,n =30;
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(d);
        System.out.println(e);
        System.out.println(f+" "+n);
    }
    public static void main1(String[] args) {
        System.out.println("hello world");//字符串常量
        System.out.println(10);//整型常量
        System.out.println(3.14);//浮点型常量
        System.out.println('A');//字符常量
        System.out.println(true);//布尔型常量
    }
}
